package com.company;

public class demo38 {
    public static void main(String[] args) {
        for (int i = 2; i <= 99; i++) {
            if (IsTG(i))
                System.out.print(i + "\t");
        }
    }

    static boolean IsTG(int x) {
        boolean b = false;
        if (x >= 1 && x <= 9) {  //i是1位数时
            if (x == (x * x) % 10) {
                b = true;
            }
        } else if (x >= 10 && x <= 99) {//i是2位数时
            if (x == (x * x) % 100) {
                b = true;
            }
        }
        return b;
    }
}
